package com.isesol.ime.rest.api;

import com.google.common.collect.Maps;
import com.isesol.api.rest.annoations.RestServiceClass;
import com.isesol.api.rest.annoations.RestServiceMethod;
import com.isesol.api.rest.model.base.BusinessResources;
import com.isesol.ime.manager.TypeManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 机床类型管理
 *
 * @author
 */
@Service
@RestServiceClass(url = "ime")
public class TypeResource extends BusinessResources {

    /**
     * 机床类型 Manager
     */
    @Resource
    TypeManager typeManager;

    @Transactional
    @RestServiceMethod(url = "type/getAll")
    public Map getAll() throws Exception {

        LOGGER.info("【机床类型】type/getAll接口调用");

        Map m = Maps.newHashMap();

        m.put("items", typeManager.findAll());

        return m;
    }
}
